<script setup lang="ts">
import {useRoute,useRouter} from "vue-router";
import {Setting, InfoFilled, Search, Menu, Document, HomeFilled} from '@element-plus/icons-vue'
import {toRef} from "vue";

const $route = useRoute()
const $router = useRouter()
let tempOrderId =toRef($route.query.orderId)
function changeActive(routerPath:string,orderId=''){
  $router.push({
    path:routerPath,
    query:{
      hoscode:$route.query.hoscode,
      orderId:orderId
    }
  })
}
</script>
<template>
  <div class="user">
    <div class="menu">
      <div class="top">
        <el-icon><HomeFilled /></el-icon>
        <span> / 会员中心</span>
      </div>
      <el-menu
          :default-active="$route.path"
          class="el-menu-vertical-demo"
      >
        <el-menu-item index="/user/certification" @click="changeActive('/user/certification',<string>tempOrderId)">
          <el-icon><Menu /></el-icon>
          <span>实名认证</span>
        </el-menu-item>
        <el-menu-item index="/user/order" @click="changeActive('/user/order',<string>tempOrderId)">
          <el-icon><document /></el-icon>
          <span>挂号订单</span>
        </el-menu-item>
        <el-menu-item index="/user/patient" @click="changeActive('/user/patient',<string>tempOrderId)">
          <el-icon><setting /></el-icon>
          <span>就诊人管理</span>
        </el-menu-item>
        <el-menu-item index="/user/profile" @click="changeActive('/user/profile',<string>tempOrderId)">
          <el-icon><InfoFilled /></el-icon>
          <span>账号信息</span>
        </el-menu-item>
        <el-menu-item index="/user/feedback" @click="changeActive('/user/feedback',<string>tempOrderId)">
          <el-icon><Search /></el-icon>
          <span>意见反馈</span>
        </el-menu-item>
      </el-menu>
    </div>
    <div class="content">
      <router-view></router-view>
    </div>
  </div>
</template>
<style scoped lang="scss">
.user{
  display: flex;
  .menu{
    flex:2;
    .top{
      margin-left: 24px;
      margin-top: 15px;
      display: flex;
      flex-direction: row;
    }
  }
  .content{
    flex:8;
  }
}
</style>